package com.li.pm.db;


public abstract class PMContent {
	
	/**
	 * 天气部分
	 * 
	 * @author lucien
	 */
	
	
	/**
	 * 一级城市表 
	 * 访问http://m.weather.com.cn/data5/city.xml得到一级列表（省、直辖市、自治区）
	 * 
	 * @author lucien
	 * 
	 */
	public static class Leve1Table {
		public static final String TABLE_NAME = "t_leve1_zone";

		public static class Columns {
			public static final String ID = "_id";
			public static final String PROVINCE_ID = "province_id";
			public static final String NAME = "name";

		}

		public static String getCreateSQL() {
			String createString = TABLE_NAME + "( " + Columns.ID
					+ " INTEGER PRIMARY KEY autoincrement, " + Columns.PROVINCE_ID
					+ " TEXT NOT NULL, " + Columns.NAME + " TEXT " + ");";

			return "CREATE TABLE " + createString;
		}

		public static String getDropSQL() {
			return "DROP TABLE " + TABLE_NAME;
		}

		public static String[] getIndexColumns() {
			return new String[] { Columns.ID, Columns.PROVINCE_ID,
					Columns.NAME };
		}

		public static String getCreateIndexSQL() {
			String createIndexSQL = "CREATE INDEX " + TABLE_NAME + "_idx ON "
					+ TABLE_NAME + " ( " + getIndexColumns()[1] + " );";
			return createIndexSQL;
		}
	}
	
	/**
	 * 二级城市表
	 * http://m.weather.com.cn/data5/city09.xml
	 * 
	 * @author lucien
	 * 
	 */
	public static class Leve2Table {
		public static final String TABLE_NAME = "t_leve2_zone";

		public static class Columns {
			public static final String ID = "_id";
			public static final String PROVINCE_ID = "province_id";
			public static final String NAME = "name";
			public static final String CITY_ID = "city_id";

		}

		public static String getCreateSQL() {
			String createString = TABLE_NAME + "( " + Columns.ID
					+ " INTEGER PRIMARY KEY autoincrement, " + Columns.PROVINCE_ID
					+ " TEXT , " + Columns.NAME + " TEXT ,"+ Columns.CITY_ID + " TEXT NOT NULL " + ");";

			return "CREATE TABLE " + createString;
		}

		public static String getDropSQL() {
			return "DROP TABLE " + TABLE_NAME;
		}

		public static String[] getIndexColumns() {
			return new String[] { Columns.ID, Columns.PROVINCE_ID,
					Columns.NAME,Columns.CITY_ID };
		}

		public static String getCreateIndexSQL() {
			String createIndexSQL = "CREATE INDEX " + TABLE_NAME + "_idx ON "
					+ TABLE_NAME + " ( " + getIndexColumns()[3] + " );";
			return createIndexSQL;
		}
	}
	
	/**
	 * 三级城市表
	 * http://m.weather.com.cn/data5/city0905.xml:
	 * 
	 * @author lucien
	 * 
	 */
	public static class Leve3Table {
		public static final String TABLE_NAME = "t_leve3_zone";

		public static class Columns {
			public static final String ID = "_id";
			public static final String CITY_ID = "city_id";
			public static final String NAME = "name";
			public static final String ZONE_ID = "zone_id";

		}

		public static String getCreateSQL() {
			String createString = TABLE_NAME + "( " + Columns.ID
					+ " INTEGER PRIMARY KEY autoincrement, " + Columns.CITY_ID
					+ " TEXT , " + Columns.NAME + " TEXT ,"+ Columns.ZONE_ID + " TEXT NOT NULL" + ");";

			return "CREATE TABLE " + createString;
		}

		public static String getDropSQL() {
			return "DROP TABLE " + TABLE_NAME;
		}

		public static String[] getIndexColumns() {
			return new String[] { Columns.ID, Columns.CITY_ID,
					Columns.NAME,Columns.ZONE_ID };
		}

		public static String getCreateIndexSQL() {
			String createIndexSQL = "CREATE INDEX " + TABLE_NAME + "_idx ON "
					+ TABLE_NAME + " ( " + getIndexColumns()[3] + " );";
			return createIndexSQL;
		}
	}
	
	
	
	
	
	
	

	/**
	 * 消息表 消息表存放消息本身
	 * 
	 * @author phoenix
	 * 
	 */
	public static class StatusesTable {
		public static final String TABLE_NAME = "t_statuses";

		public static class Columns {
			public static final String ID = "_id";
			public static final String STATUS_ID = "status_id";
			public static final String AUTHOR_ID = "author_id";
			public static final String TEXT = "text";
			public static final String SOURCE = "source";
			public static final String CREATED_AT = "created_at";
			public static final String TRUNCATED = "truncated";
			public static final String FAVORITED = "favorited";
			public static final String PHOTO_URL = "photo_url";
			public static final String IN_REPLY_TO_STATUS_ID = "in_reply_to_status_id";
			public static final String IN_REPLY_TO_USER_ID = "in_reply_to_user_id";
			public static final String IN_REPLY_TO_SCREEN_NAME = "in_reply_to_screen_name";

		}

		public static String getCreateSQL() {
			String createString = TABLE_NAME + "( " + Columns.ID
					+ " INTEGER PRIMARY KEY, " + Columns.STATUS_ID
					+ " TEXT UNIQUE NOT NULL, " + Columns.AUTHOR_ID + " TEXT, "
					+ Columns.TEXT + " TEXT, " + Columns.SOURCE + " TEXT, "
					+ Columns.CREATED_AT + " INT, " + Columns.TRUNCATED
					+ " INT DEFAULT 0, " + Columns.FAVORITED
					+ " INT DEFAULT 0, " + Columns.PHOTO_URL + " TEXT, "
					+ Columns.IN_REPLY_TO_STATUS_ID + " TEXT, "
					+ Columns.IN_REPLY_TO_USER_ID + " TEXT, "
					+ Columns.IN_REPLY_TO_SCREEN_NAME + " TEXT " + ");";

			return "CREATE TABLE " + createString;
		}

		public static String getDropSQL() {
			return "DROP TABLE " + TABLE_NAME;
		}

		public static String[] getIndexColumns() {
			return new String[] { Columns.ID, Columns.STATUS_ID,
					Columns.AUTHOR_ID, Columns.TEXT, Columns.SOURCE,
					Columns.CREATED_AT, Columns.TRUNCATED, Columns.FAVORITED,
					Columns.PHOTO_URL, Columns.IN_REPLY_TO_STATUS_ID,
					Columns.IN_REPLY_TO_USER_ID,
					Columns.IN_REPLY_TO_SCREEN_NAME };
		}

		public static String getCreateIndexSQL() {
			String createIndexSQL = "CREATE INDEX " + TABLE_NAME + "_idx ON "
					+ TABLE_NAME + " ( " + getIndexColumns()[1] + " );";
			return createIndexSQL;
		}
	}

	
}
